<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../../vue3.js"></script>
    <style>
        #app {
            width: 600px;
            height: 600px;
        }
        
        .uls {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        img {
            display: block;
            width: 100px;
            height: 100px;
            margin: 10px;
        }
        
        .del {
            margin: 20px 10px;
        }
    </style>
</head>

<body>
    <div id="app">
        <ul>
            <li class="uls" v-for="item in list" :key="item.id">
                <input type="checkbox" v-model="checkadd" :value="item" />
                <img :src="item.pic" alt="" />
                <div>
                    <p>商品：{{item.name}}</p>
                    <p style="color: red">价格：￥{{item.price}}</p>
                </div>
                <div>
                    <button>-</button>
                    <span>{{item.Number}}</span>
                    <button>+</button>
                </div>
                <div>
                    <button class="del">删除</button>
                </div>
            </li>
        </ul>
        总金额:
        <div>{{checkadd}}</div>
    </div>
    <script>
        var obj = {
            data() {
                return {
                    checkadd: [], //勾选的购物车数据
                    list: [{
                        id: 1,
                        name: "商品1",
                        price: 10,
                        Number: 1,
                        limit: 5, //限购
                        pic: "https://img1.baidu.com/it/u=1067185695,313237051&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    }, {
                        id: 2,
                        name: "商品2",
                        price: 10,
                        Number: 1,
                        limit: 5, //限购
                        pic: "https://img1.baidu.com/it/u=1067185695,313237051&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    }, {
                        id: 3,
                        name: "商品3",
                        price: 10,
                        Number: 1,
                        limit: 5, //限购
                        pic: "https://img1.baidu.com/it/u=1067185695,313237051&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    }, {
                        id: 4,
                        name: "商品4",
                        price: 10,
                        Number: 1,
                        limit: 5, //限购
                        pic: "https://img1.baidu.com/it/u=1067185695,313237051&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750",
                    }, ],
                };
            },
        };
        Vue.createApp(obj).mount("#app");
    </script>
</body>

</html>